package com.example.game.console.domain;


import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;


@Data
@Accessors(chain = true)
public class GameInfoVO {
    private String title;
    private Integer createTime;
    private List<String> coverImages;
    private String gameName;
    private String releaseDate;
    private Float price;
    private BigInteger categoryId;
    private String gameDescription;
    private Float rating;
    private Integer updateTime;

    public String getCreateTime() {
        return convertTimestampToString(this.createTime);
    }

    public String getUpdateTime() {
        return convertTimestampToString(this.updateTime);
    }

    private String convertTimestampToString(int timestamp) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+8"));
        return dateFormat.format(new Date(timestamp * 1000L));
    }

}
